package com.example.intelligentattendancesystem.pojo;

import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.Objects;

/**
 * @author tonyblack
 * @version 1.0
 * @since 1.0
 */
@Component
public class Work implements Comparable<Work>{
    private Integer id;
    private int userId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Work work = (Work) o;
        return userId == work.userId && Objects.equals(id, work.id) && Objects.equals(startTime, work.startTime) && Objects.equals(endTime, work.endTime) && Objects.equals(week, work.week);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, startTime, endTime, week);
    }

    private String startTime;
    private String endTime;
    private String week;

    @Override
    public String toString() {
        return "Work{" +
                "id=" + id +
                ", userId=" + userId +
                ", startTime='" + startTime + '\'' +
                ", endTime='" + endTime + '\'' +
                ", week='" + week + '\'' +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public String getWeek() {
        return week;
    }

    public void setWeek(String week) {
        this.week = week;
    }

    public Work(Integer id, int userId, String startTime, String endTime, String week) {
        this.id = id;
        this.userId = userId;
        this.startTime = startTime;
        this.endTime = endTime;
        this.week = week;
    }

    public Work() {
    }

    @Override
    public int compareTo(Work o) {
        return this.getStartTime().compareTo(o.getStartTime());
    }
}
